//
//  RouteAnnotationView.m
//  location
//
//  Created by Dongxiang Xu on 2024/5/14.
//

#import "RouteAnnotationView.h"

@interface RouteAnnotationView ()



@end

@implementation RouteAnnotationView

- (instancetype)initWithAnnotation:(nullable id <MKAnnotation>)annotation reuseIdentifier:(nullable NSString *)reuseIdentifier
{
    self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
    
    if (self) {
        self.bounds = CGRectMake(0.f, 0.f, 48, 48);
                
        UIImageView *head = [[UIImageView alloc] initWithFrame:CGRectMake((self.bounds.size.width-8)/2, 16, 8, 8)];
        [self addSubview:head];
        CALayer *subLayer = [CALayer layer];
        subLayer.frame = head.bounds;
        subLayer.cornerRadius = 4;
        subLayer.masksToBounds = NO;
        subLayer.backgroundColor = RealWhiteColor.CGColor;
        subLayer.shadowColor = RealBlackColor.CGColor;
        subLayer.shadowOffset = CGSizeMake(0,2);
        subLayer.shadowOpacity = 0.3;
        subLayer.shadowRadius = 3;
        [head.layer addSublayer:subLayer];
        
        UIImageView *mapImg = [[UIImageView alloc] initWithFrame:CGRectMake(2, 2, 4, 4)];
        mapImg.layer.masksToBounds = YES;
        [mapImg.layer setCornerRadius:2];
        mapImg.backgroundColor = RealBlackColor;
        [head addSubview:mapImg];
        
        self.locationImg = [[UIImageView alloc] initWithFrame:CGRectMake((self.bounds.size.width-17)/2, 3, 17, 17)];
        self.locationImg.contentMode = UIViewContentModeScaleAspectFit;
        [self addSubview:self.locationImg];
    }
    
    return self;
}

@end
    
